package routes

import (
	"gitee.com/igolang/imoney/internal/app/system/controllers"
	"gitee.com/igolang/imoney/internal/router/middleware"
	"github.com/gin-gonic/gin"
)

type router struct {
	engine *gin.Engine
	g      *gin.RouterGroup
	mg     *gin.RouterGroup
}

func Init(engine *gin.Engine) {
	(&router{}).init(engine)
}

func (r *router) init(engine *gin.Engine) {
	r.engine = engine
	r.g = engine.Group(
		"system",
		middleware.SysRequest(),
		controllers.CheckToken,
		controllers.WrapperResponse,
	)
	r.mg = engine.Group(
		"monitor",
		middleware.SysRequest(),
		controllers.CheckToken,
		controllers.WrapperResponse,
	)
	fs := []func(){
		r.common,
		r.menu,
		r.user,
		r.role,
		r.dict,
		r.config,
		r.dept,
		r.post,
		r.notice,
		r.log,
		r.monitor,
	}

	for _, f := range fs {
		f()
	}
}
